import request from '@/utils/request'

const saveSetMeal = function(data) {
  return request({
    url: '/sysSetMeal/saveSetMeal',
    method: 'post',
    data: data
  })
}

const updateSetMeal = function(data) {
  return request({
    url: '/sysSetMeal/updateSetMeal',
    method: 'post',
    data: data
  })
}

const listMealType = function() {
  return request({
    url: '/sysSetMeal/listMealType',
    method: 'get',
    params: {}
  })
}

const listSetMealByType = function(mealType) {
  return request({
    url: '/sysSetMeal/listSetMealByType',
    method: 'get',
    params: { mealType: mealType }
  })
}
const handleEditPrice = function(data) {
  return request({
    url: '/sysSetMeal/listMealPrice',
    method: 'post',
    data: data
  })
}
const saveMealPrice = function(data) {
  return request({
    url: '/sysSetMeal/saveMealPrice',
    method: 'post',
    data: data
  })
}
const updateMealPrice = function(data) {
  return request({
    url: '/sysSetMeal/updateMealPrice',
    method: 'post',
    data: data
  })
}

const getCoverageBySetMeal = function(data) {
  return request({
    url: '/sysSetMeal/getCoverageBySetMeal?mealType=' + data,
    method: 'get'
  })
}
const saveCoverage = function(data) {
  return request({
    url: '/sysSetMeal/saveCoverage',
    method: 'post',
    data: data
  })
}

export const setMealApi = {
  saveSetMeal: saveSetMeal,
  updateSetMeal: updateSetMeal,
  listMealType: listMealType,
  listSetMealByType: listSetMealByType,
  handleEditPrice: handleEditPrice,
  saveMealPrice: saveMealPrice,
  updateMealPrice: updateMealPrice,
  getCoverageBySetMeal: getCoverageBySetMeal,
  saveCoverage: saveCoverage
}
